package edu.sctu.practice.class01.fengleilin.test18;

/**
 * Created by fll on 2015/11/2.
 */

/**
 * 建立一个汽车Auto类，包括轮胎个数，汽车颜色，车身重量、速度等成员变量。
 * 并通过不同的构造方法创建实例。至少要求：汽车能够加速，减速，停车。
 */
public class Auto {

    public int num;
    public String color;
    public int weight;
    public  int speed;

    public Auto(int num,String color,int weight){
        this.num = num;
        this.color = color;
        this.weight = weight;
    }

    public Auto(int speed){
        this.speed = speed;
        if (speed > 0){
            System.out.println("该车正在加速，加了" + speed);
        }else if (speed < 0){
            System.out.println("该车正在减速，减了" + speed);
        }else{
            System.out.println("该车在停车，速度为" + speed);
        }
    }

}
